﻿using System;
using kunukn.RecommendationEngine.AreaRecommendation.Code.Entities;
using kunukn.RecommendationEngine.AreaRecommendation.Code.Helpers;
using kunukn.RecommendationEngine.AreaRecommendation.Code.Web;


namespace kunukn.RecommendationEngine.AreaRecommendation
{
    /// <summary>
    /// Author: Kunuk Nykjaer
    /// </summary>
    public partial class ItemPage : MyPage
    {       
        protected void Page_Init(object sender, EventArgs e)
        {
            var queryItemName = Request.QueryString[Item.ItemKey];
            if (queryItemName != null)
            {                
                var itemName = queryItemName.HtmlEncode();
                if ( itemName.IsValidaItemName() )
                {
                    int index = itemName.GetItemIndex();
                    CurrentItem = SessionHelper.GetItem2Item().GetItems()[index];
                }
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}